package com.thysdy.flowable.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.thysdy.flowable.entity.ActIdUser;
import com.thysdy.flowable.service.IActIdUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class FlowablePersonInfoService {
    @Resource
    IActIdUserService userService;

    public Map<String, ActIdUser> getPersonInfoList(List<String> ids) {
        if (null != ids && ids.size() > 0) {
            Map<String, ActIdUser> map = new HashMap<>();
            LambdaQueryWrapper<ActIdUser> queryWrapper = new LambdaQueryWrapper<>();
            queryWrapper.in(ActIdUser::getId, ids);
            List<ActIdUser> users = userService.list(queryWrapper);
            if (null != users && !users.isEmpty()) {
                users.forEach(x -> map.put(x.getId(), x));
            } else {
                return null;
            }
            return map;
        } else {
            return null;
        }
    }
}
